package com.bsj.travel.monitor.web.controller;

import com.bsj.travel.def.common.DTO.web.monitor.SysLogDTO;
import com.bsj.travel.def.global.JsonResult;
import com.bsj.travel.def.monitor.CloudLog;
import com.bsj.travel.monitor.service.SysLogService;
import com.bsj.travel.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author yinhao
 * @version 1.0
 * @description 日志控制器
 * @date 2024/1/26
 */
@RestController
@RequestMapping(value = "/log")
public class SysLogController {

    @Autowired
    private SysLogService sysLogService;

    /**
     * 分页查询日志列表
     * @param sysLog 请求对象
     * @return
     */
    @RequiresPermissions("monitor:log:list")
    @GetMapping(value = "/list")
    public JsonResult<List<CloudLog>> list(@Validated SysLogDTO sysLog) {
        return sysLogService.selectLogPageList(sysLog);
    }
}
